

global gendervar le_1990 le_2000 inf_dr_1981 le_1981 inf_dr_1990 lit_1982 lit_1990 ///
				 yedu_1982 primary_1982 junior_1982 high_1982 college_1982 lp_1982 lp_1990 ///
				 yedu_1990 primary_1990 junior_1990 high_1990 college_1990 onlyone_sh  onlyone_sh_be90 
				 
global var1 pop_br_1981 pop_br_1990 pop_dr_1981 pop_dr_1990 inf_dr_1981 inf_dr_1990 le_1981 le_1990 le_2000 ///
			gdppc*  lgdppc*   beds_1993 medemp_1993 agri_* br_t* jhsyl_1988 lit_1982 lit_1990 ///
			yedu_1982 primary_1982 junior_1982 high_1982 college_1982 lp_1990 yedu_1990 primary_1990 junior_1990 high* college_1990 ///
			hos_1981 hl_ins_1981 beds_1981 beds_hos_1981  hl_emp_1981 onlyone_sh  onlyone_sh_be90 lhos_1981 lhl_ins_1981 lbeds_1981 lbeds_hos_1981  lhl_emp_1981
 
global var2 *_gap* fem_head* 

global var3 lgdppc_1952 lgdppc_1965 lgdppc_1980 lgdppc_1990 agri_sh_1952 agri_sh_1965 agri_sh_1980 agri_sh_1990 ///
			br_t_1980 br_t_1987 pop_br_1981 pop_br_1990 onlyone_sh onlyone_sh_be90 inf_dr_1981 inf_dr_1990 le_1981 le_1990 le_2000 ///
			lit_1982 lit_1990 yedu_1982 yedu_1990 primary_1982 primary_1990 junior_1982 junior_1990
			
global var4 inf_dr_1981 inf_dr_1990 le_1981 le_1990 le_2000 inf_dr_1981_gap1 inf_dr_1990_gap1 le_1981_gap1 le_1990_gap1 le_2000_gap1 fem_head_sh_1982 fem_head_sh_1990  ///
			lgdppc_1990 br_t_1980 onlyone_sh lit_1982
			
		
cd " "

use prov_var.dta, clear

merge 1:1 prov using prov_est_5census_yedu_n
drop _merge

merge 1:1 prov using prov_season_pq
drop _merge

// Figure A3
reg overall_n diff_pq if prov!=54
reg diff_n diff_pq if prov!=54

twoway (scatter overall_n diff_pq if prov!=54, mlabel(provlbl) mlabs(medium) mlabposition(12)  ) (lfit overall_n diff_pq if prov!=54, lcolor(black) )
twoway (scatter diff_n diff_pq if prov!=54, mlabel(provlbl) mlabs(medium) mlabposition(12)  ) (lfit diff_n diff_pq if prov!=54, lcolor(black) )

foreach var of varlist $gendervar {
	gen `var'_gap1 = `var'_m - `var'_f
	gen `var'_gap2 = `var'_m / `var'_f
}

foreach var of varlist gdppc* conspc* hos_1981 hl_ins_1981 beds_1981 beds_hos_1981  hl_emp_1981 {
	replace `var' = `var'*10000
	gen l`var' = log(`var')
}

foreach var of varlist gdppc* $var1 $var2 $var3 $var4  {
	egen std_`var' = std(`var')
	replace `var' = std_`var'
	drop std_`var'
}

foreach var of varlist overall* diff* {
	egen std_`var' = std(`var')
	replace `var' = std_`var'
	drop std_`var'	
}

*******************************************************************
							* Figure E1  *
*******************************************************************

gen overall = overall_n
gen diff = diff_n

* (a) unweighted * ________________________________________________

* Panel A.
	reg overall lgdppc_1952 , r
	reg overall lgdppc_1965 , r
	reg overall lgdppc_1980 , r
	reg overall lgdppc_1990 , r

* Panel B.
	reg overall br_t_1980, r
	reg overall onlyone_sh_be90, r
	
* Panel C.
	reg overall le_1981, r
	reg overall le_1990, r
	reg overall inf_dr_1981, r
	reg overall inf_dr_1990, r
	
* Panel D. Educational Variables
	reg overall lit_1982, r
	reg overall primary_1982, r	
	reg overall junior_1982, r		
	reg overall high_1982, r			
		
	
* (b) weighted * ________________________________________________

* Panel A. 
	reg overall gdppc_1952 [w=count] , r
	reg overall gdppc_1965 [w=count] , r
	reg overall gdppc_1980 [w=count] , r
	reg overall gdppc_1990 [w=count] , r
	
* Panel B. 
	reg overall br_t_1980 [w=count], r
	reg overall onlyone_sh_be90 [w=count], r
	
* Panel C.
	reg overall le_1981 [w=count], r
	reg overall le_1990 [w=count], r
	reg overall inf_dr_1981 [w=count], r
	reg overall inf_dr_1990 [w=count], r

* Panel D. 
	reg overall lit_1982 [w=count], r
	reg overall primary_1982 [w=count], r	
	reg overall junior_1982 [w=count], r		
	reg overall high_1982 [w=count], r			
	
	
* (c) junior high school completion * ___________________________

* Panel A.
	reg overall_junior gdppc_1952 , r
	reg overall_junior gdppc_1965 , r
	reg overall_junior gdppc_1980 , r
	reg overall_junior gdppc_1990 , r
	
* Panel B.
	reg overall_junior br_t_1980 , r
	reg overall_junior onlyone_sh_be90 , r
	
* Panel C.
	reg overall_junior le_1981 , r
	reg overall_junior le_1990 , r
	reg overall_junior inf_dr_1981 , r
	reg overall_junior inf_dr_1990 , r
	
* Panel D. 
	reg overall_junior lit_1982, r
	reg overall_junior primary_1982, r	
	reg overall_junior junior_1982, r		
	reg overall_junior high_1982, r			


*******************************************************************
							* Figure A2  *
*******************************************************************

* Exclude two outliers
	drop if prov==11
	drop if prov==54

* (a) unweighted * ________________________________________________

* Panel A. Whole Sample Estimates
	reg diff overall, r
	reg diff overall_junior, r
	
* Panel B. Economic Variables
	reg diff gdppc_1952 , r
	reg diff gdppc_1965 , r
	reg diff gdppc_1980 , r
	reg diff gdppc_1990 , r

* Panel C. Dempographic Variables
	reg diff br_t_1980, r
	reg diff onlyone_sh_be90, r

* Panel D. Health Variables
	reg diff le_1981, r
	reg diff le_1990, r
	reg diff inf_dr_1981, r
	reg diff inf_dr_1990, r
	
* Panel E. Educational Variables
	reg diff lit_1982, r
	reg diff primary_1982, r	
	reg diff junior_1982, r		
	reg diff high_1982, r			

* Panel F. Gender Difference Variables
	reg diff le_1981_gap1, r
	reg diff le_1990_gap1, r	
	reg diff inf_dr_1981_gap1, r
	reg diff inf_dr_1990_gap1, r
	reg diff lit_1982_gap2, r
	reg diff primary_1982_gap2, r
	reg diff fem_head_sh_1982, r
	reg diff fem_head_sh_1990, r	
	
* (b) weighted * ________________________________________________

* Panel A. Whole Sample Estimates
	reg diff overall [w=count], r
	reg diff overall_junior [w=count], r
	
* Panel B. Economic Variables
	reg diff gdppc_1952 [w=count], r
	reg diff gdppc_1965 [w=count], r
	reg diff gdppc_1980 [w=count], r
	reg diff gdppc_1990 [w=count], r

* Panel C. Dempographic Variables
	reg diff br_t_1980 [w=count], r
	reg diff onlyone_sh_be90 [w=count], r

* Panel D. Health Variables
	reg diff le_1981 [w=count], r
	reg diff le_1990 [w=count], r
	reg diff inf_dr_1981 [w=count], r
	reg diff inf_dr_1990 [w=count], r
	
* Panel E. Educational Variables
	reg diff lit_1982 [w=count], r
	reg diff primary_1982 [w=count], r	
	reg diff junior_1982 [w=count], r		
	reg diff high_1982 [w=count], r			

* Panel F. Gender Difference Variables
	reg diff le_1981_gap1 [w=count], r
	reg diff le_1990_gap1 [w=count], r	
	reg diff inf_dr_1981_gap1 [w=count], r
	reg diff inf_dr_1990_gap1 [w=count], r
	reg diff lit_1982_gap2 [w=count], r
	reg diff primary_1982_gap2 [w=count], r
	reg diff fem_head_sh_1982 [w=count], r
	reg diff fem_head_sh_1990 [w=count], r

	
* (c) junior high school completion * ___________________________

* Panel A. Whole Sample Estimates
	reg diff_junior overall , r
	reg diff_junior overall_junior , r
	
* Panel B. Economic Variables
	reg diff_junior gdppc_1952 , r
	reg diff_junior gdppc_1965 , r
	reg diff_junior gdppc_1980 , r
	reg diff_junior gdppc_1990 , r

* Panel C. Dempographic Variables
	reg diff_junior br_t_1980 , r
	reg diff_junior onlyone_sh_be90 , r

* Panel D. Health Variables
	reg diff_junior le_1981 , r
	reg diff_junior le_1990 , r
	reg diff_junior inf_dr_1981 , r
	reg diff_junior inf_dr_1990 , r
	
* Panel E. Educational Variables
	reg diff_junior lit_1982 , r
	reg diff_junior primary_1982 , r	
	reg diff_junior junior_1982 , r		
	reg diff_junior high_1982 , r			

* Panel F. Gender Difference Variables
	reg diff_junior le_1981_gap1 , r
	reg diff_junior le_1990_gap1 , r	
	reg diff_junior inf_dr_1981_gap1 , r
	reg diff_junior inf_dr_1990_gap1 , r
	reg diff_junior lit_1982_gap2 , r
	reg diff_junior primary_1982_gap2 , r
	reg diff_junior fem_head_sh_1982 , r
	reg diff_junior fem_head_sh_1990 , r	

